home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Toolbox
/
Visual Basic Toolbox (P.I.E.)(1996).ISO
/
listbox
/
mlist46
/
itmhite.frm
< prev
next >
Wrap
Text File
|
1995-09-04
|
7KB
|
249 lines
VERSION 2.00
Begin Form Form1
Caption = "ItemHeight Demo"
ClientHeight = 2670
ClientLeft = 1095
ClientTop = 1755
ClientWidth = 6750
Height = 3360
Left = 1035
LinkTopic = "Form1"
ScaleHeight = 2670
ScaleWidth = 6750
Top = 1125
Width = 6870
Begin CommandButton cmdReload
Caption = "Reload MList"
Height = 312
Left = 4080
TabIndex = 8
Top = 1800
Width = 2415
End
Begin CommandButton cmdAddItems
Caption = "Add Items"
Height = 312
Left = 4080
TabIndex = 7
Top = 1440
Width = 2415
End
Begin CommandButton cmdSetHeight
Caption = "Set Height"
Height = 312
Left = 5280
TabIndex = 6
Top = 960
Width = 1215
End
Begin CommandButton cmdSetSize
Caption = "Set Size"
Height = 312
Left = 5280
TabIndex = 5
Top = 480
Width = 1215
End
Begin TextBox txtItemHeight
Height = 285
Left = 4080
TabIndex = 4
Text = "txtItemHeight"
Top = 960
Width = 855
End
Begin TextBox txtFontSize
Height = 285
Left = 4080
TabIndex = 2
Text = "txtFontSize"
Top = 480
Width = 855
End
Begin MListBox MList1
AddItemHeight = 0
Alignment = 0 'None
AllowFocusRect = -1 'True
AutoCheck = -1 'True
BorderStyle = 0 'Normal
CheckColor = &H00000000&
CheckStyle = 0 'Cross Style
DrawRegions = 0
EnableVirtualMsgs= 0 'False
ExtendedSelect = 0 'False
FallColor = &H00808080&
FindDirection = 0 'Forward
FindResult = 0 'Update ListIndex
GridColor = &H00808080&
GridStyle = 0 'Solid
Height = 1395
HiliteBackColor = &H00000000&
HiliteForeColor = &H00000000&
HorizontalGrids = -1 'True
ImageRegion = 0
ImageType = 0 'None
ItemHeight = 195
ItemWidth = 1560
Left = 600
ListBoxStyle = 1 'Variable
MaskingColor = &H00FFFFFF&
MultiColumn = 0 'False
MultiSelect = 0 'False
NoIntegralHeight= 0 'False
OwnerCompare = 0 'False
OwnerDraw = 0 'False
Partner = 0
RiseColor = &H00FFFFFF&
SearchCompare = 1 'Case Insensitive
SelectMode = 0 'Normal
SortColumn = 0
Sorted = 0 'False
SortOrder = 0 'Ascending
SortType = 0 'String
StringCompare = 0 'Case Sensitive
TabIndex = 0
Top = 360
Version = "04.60"
VerticalGrids = 0 'False
VirtualMsgZone = 0
Width = 2055
End
Begin Label lblItemHeight
AutoSize = -1 'True
Caption = "ItemHeight is:"
Height = 195
Left = 600
TabIndex = 9
Top = 2040
Visible = 0 'False
Width = 1185
End
Begin Label Label2
Caption = "ItemHeight:"
Height = 195
Left = 2880
TabIndex = 3
Top = 960
Width = 1095
End
Begin Label Label1
Caption = "FontSize:"
Height = 195
Left = 2880
TabIndex = 1
Top = 480
Width = 855
End
Begin Menu mnuOptions
Caption = "&Options"
Begin Menu mnuOSkipReload
Caption = "&Skip Reload"
Checked = -1 'True
End
Begin Menu mnuOSep3
Caption = "-"
End
Begin Menu mnuOShowLabelControl
Caption = "&Show Label Control"
End
Begin Menu mnuOSep2
Caption = "-"
End
Begin Menu mnuOExit
Caption = "E&xit"
End
End
End
Option Explicit
Dim msItem() As String
Sub cmdAddItems_Click ()
Dim i As Integer
For i = Mlist1.ListCount + 1 To Mlist1.ListCount + 10
Mlist1.AddItem "Item" & Format$(i, "000")
Next
End Sub
Sub cmdReload_Click ()
Call MListItemsResize(Mlist1, lblItemHeight.Height)
End Sub
Sub cmdSetHeight_Click ()
Mlist1.AddItemHeight = txtItemHeight
lblItemHeight = txtItemHeight
If mnuOSkipReload.Checked Then
Mlist1.ItemHeight = txtItemHeight
Else
Call MListItemsResize(Mlist1, txtItemHeight)
End If
End Sub
Sub cmdSetSize_Click ()
' turn off redraw until all changes are complete
Mlist1.DisableDrawing = True
Mlist1.FontSize = txtFontSize
lblItemHeight.FontSize = Mlist1.FontSize
'lblItemHeight's AutoSize property is true, and we use
' this to get the new item height for the MList, since
' they both are using the same font and fontsize.
lblItemHeight = lblItemHeight.Height
txtItemHeight = lblItemHeight.Height
If mnuOSkipReload.Checked Then
Mlist1.AddItemHeight = lblItemHeight.Height
Else
Call MListItemsResize(Mlist1, lblItemHeight.Height)
End If
' we're done, so redraw the control
Mlist1.DisableDrawing = False
End Sub
Sub Form_Load ()
Dim i As Integer
For i = 1 To 20
Mlist1.AddItem "Item" & Format$(i, "000")
Next
txtFontSize = Mlist1.FontSize
txtItemHeight = Mlist1.ItemHeight
lblItemHeight = lblItemHeight.Height
End Sub
Sub mnuOExit_Click ()
Unload Me
End Sub
Sub mnuOShowLabelControl_Click ()
mnuOShowLabelControl.Checked = Not mnuOShowLabelControl.Checked
If mnuOShowLabelControl.Checked Then
lblItemHeight.Visible = True
Else
lblItemHeight.Visible = False
End If
End Sub
Sub mnuOSkipReload_Click ()
mnuOSkipReload.Checked = Not mnuOSkipReload.Checked
End Sub